#!/bin/sh

project="rdp"

# 预设几个常用分支，不用每次都输入
branch1="feature-liufq"

dir="/root/shell/${project}"

branch=$1

if [[ -z "$branch" ]]; then
        branch="master"
elif [[ $1 == "1" ]]; then
        branch=$branch1
fi

echo "------------ 开始部署 ${branch} 分支 ------------"

cd $dir
git pull
git checkout -b $branch origin/${branch}
git pull

mvn clean install
/bin/cp -rf ${dir}/web/target/RDP.war /home/tomcat/webapps/

echo "------------ 部署完成 ------------"